class Solution {
public:
    int strStr(string h, string n) {
        // 本题是模拟实现C语言库函数中的strstr()函数
        int start = 0, left = 0, right = 0, hSize = h.size(), nSize = n.size();
        while(start < hSize)
        {
            left = start;
            while(right < nSize && h[left] == n[right])
            {
                left++;
                right++;
            }
            if(right == nSize)
                break;
            else
                right = 0;
            start++;
        }
        if(start == hSize)
            return -1;
        return start;
    }
};